cmake_minimum_required(VERSION 3.10)
# project information
project(mycode-uart-example)

# Compile options
add_compile_options(-std=c++11)

#设置交叉编译器
if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch")
    set(CMAKE_CXX_COMPILER g++)
else (CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
    set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
endif()

# Specify target generation path  
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY  "../output")
set(CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -g -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -O0 -Wall")

# Header path
include_directories(
    ../include/
)
# add lib path
link_directories(
    ../lib/
)

# 生成可执行文件名称
add_executable(uart_test
main.cpp
i2c2.cpp
sht20.cpp
oled_ssd1306.cpp
spi0.cpp
uart1.cpp
rtc_ds1339.cpp
PCA9557.cpp
)

target_link_libraries(uart_test stdc++)

install(TARGETS uart_test DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})